  //校验是否有token
  if (! localStorage.getItem('token') ) {
    location.href = './login.html'
}
//渲染用户名
let userNameSpan = document.querySelector('.navbar-nav .font-weight-bold')
userNameSpan.innerHTML = localStorage.getItem('username')
   //退出登录
   document.querySelector('#logout').addEventListener('click',e=>{
      localStorage.clear()
      location.href = './login.html'
   }) 